package player;

/**
 *
 * @author Michael Hanns
 *
 */
public class FlagImp implements Flag {

    private String flagType;
    private int effectDuration;
    private boolean tick;
    private int flagIntensity;
    private long flagCreated;

    public FlagImp(String type, int effectDuration, boolean tick, int intensity) {
        this.flagType = type;
        this.effectDuration = effectDuration; // Effect duration in ticks.
        this.tick = tick;
        this.flagIntensity = intensity;
        this.flagCreated = System.currentTimeMillis();
    }

    public boolean effectOnTick() {
        return tick;
    }

    public boolean isType(String type) {
        if (flagType.equalsIgnoreCase(type)) {
            return true;
        }
        return false;
    }

    public boolean expired() {
        if (flagCreated + (effectDuration * 1000) < System.currentTimeMillis()) {
            return true;
        }
        return false;
    }
}
